<?php
/**
 *  CConfig Class
 *
 *  @author $Author: jinsonxu@gmail.com $:
 *  $Date: 2014-11-14 05:59:34 +0000 (Fri, 14 Nov 2014) $:
 *  $Id: CGConfig.php 15 2014-11-14 05:59:34Z jinsonxu@gmail.com $:
 *  @version $Rev: 15 $:
 *  @package crawlgenie.application
 */

class CGConfig {
    /**
     *  General App Config
    */
    public static $displayErrors = true;
    public static $sourcesDirName = 'src'; //default sources dir. Should not need to change
    public static $libDirName = 'lib'; //default lib dir. Should not need to change

    public static $networkProxy = 'proxy.sg.kworld.kpmg.com:8080';

    /**
     * DB Config
    */
    public static $dbType = 'pgsql';
    public static $dbName = 'crawlgenie';
    public static $dbHost = '127.0.0.1';
    public static $dbUserName = 'crawlgenie';
    public static $dbPassword = '687yfih';

    /**
     * Locale & Session Settings
    */
    public static $timezone = 'Asia/Singapore';
    public static $sessionLifeTime = 9000; //session lifetime in seconds.
    public static $sessionTokenSeed = 'iojosdf68o3jhs';
    public static $cookieName = 'CGSESSCOOKIE';


    /**
     * Libraries Config
    */
    public static $loggerLibDir = 'log4php';
    
    
    
    /**
     * Crawler timings
     */
    private static $offPeakMinDelay = 500000;  //milliseconds
    private static $offPeakMaxDelay = 1500000; 
    private static $peakMinDelay = 1000000;
    private static $peakMaxDelay = 2500000;
    
    public static function getMinDelay() {
        $currentHour = date('G');
        return ($currentHour > 8 && $currentHour < 19) ? self::$peakMinDelay : self::$offPeakMinDelay;
    }
    
    public static function getMaxDelay() {
        $currentHour = date('G');
        return ($currentHour <= 8 || $currentHour >= 19) ? self::$offPeakMaxDelay : self::$peakMaxDelay;        
    }
    

}


?>